<template>
  <div class="flex flex-col h-full">
    <SearchContainer @reset="() => formRef.resetFields()">
      <a-form ref="formRef" class="form-style-flex" :model="formState">
        <a-form-item name="stdate" label="日期范围" class="w-[300px]">
          <a-range-picker v-model:value="formState.dateRange" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
        </a-form-item>
        <a-form-item name="lb" label="" class="w-1/4 ml-3">
          <a-radio-group v-model:value="formState.lx">
            <a-radio value="0">门诊</a-radio>
            <a-radio value="1">住院</a-radio>
          </a-radio-group>
        </a-form-item>
      </a-form>
    </SearchContainer>
    <a-card class="mt-2 flex-1">
      <a-space class="flex justify-end mb-2">
        <BaseExport type="物资" name="未发药查询" code="000173" :search-params="formState">导出</BaseExport>
      </a-space>
      <BaseTable :loading="loading" column-code="000173" :data-source="tableData" bordered fill>
        <template #bodyCell="{ column, index, record }">
          <template v-if="column.dataIndex == 'xh'">
            {{ index + 1 }}
          </template>
          <template v-if="column.dataIndex === 'ypmc'">
            <MedicineInfo :value="{ mc: record?.ypmc, gg: record?.gg, cj: record?.cj }" />
          </template>
        </template>
      </BaseTable>
    </a-card>
  </div>
</template>
<script setup>
import { ref } from 'vue'
import dayjs from 'dayjs'
import SearchContainer from '@/components/SearchContainer'
import BaseTable from '@/components/BaseTable'

const formState = ref({
  dateRange: [dayjs().format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')],
  lx: ''
})
const formRef = ref()
const loading = ref(false)
const tableData = ref([
  {
    cklx: '1',
    czsj: '1',
    ckmc: '1',
    ypmc: '',
    gg: '',
    sl: '',
    dw: '',
    ph: '',
    cbj: '',
    cbje: '',
    czr: ''
  }
])
</script>
